fn main() {
    for n in 1..101 {
        fun(n);
    }
    // =100 包含100
    for n in 1..=100 {
        fun(n);
    }

    let mut names = vec!["Bob", "Frank", "Ferris"];
    // todo 解引用不明白，插个👀
    for name in names.iter_mut() {
        *name = match name {
            &mut "Ferris" => "There is a rustacean among us!",
            _ => "Hello",
        }
    }
    println!("names: {:?}", names);

    // iter() 是借用集合中的元素，用完还能接着用,但值不能修改
    let names = vec!["Bob", "Frank", "Ferris"];
    for name in names.iter() {
        match name {
            &"Ferris" => println!("There is a rustacean among us !"),
            _ => println!("Hello {}", name),
        }
    }

    // into_iter() 是移动的方式使用元素，用完不能接着用
    for name in names.into_iter() {
        match name {
            "Ferris" => println!("There is a rustacean among us!"),
            _ => println!("Hello,{}", name),
        }
    }
}

fn fun(n: i32) {
    if n % 15 == 0 {
        println!("fizzbuzz");
    } else if n % 3 == 0 {
        println!("fizz");
    } else if n % 5 == 0 {
        println!("buzz");
    } else {
        println!("{}", n);
    }
}
